package com.back.config;

import com.back.model.MinIOProperty;
import io.minio.MinioClient;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class Minio {

    @Resource
    private MinIOProperty minIOProperty;

    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder()
                .endpoint(minIOProperty.getEndpoint()) //操作MinIO地址
                .credentials(minIOProperty.getAccessKey(), minIOProperty.getSecretKey())
                .build();
    }

}
